<?php 
class Application_Model_PathLevel extends Application_Model_DomainObject {
    
    protected $_id;
    /**
     * 业务类型
     */
    protected $_objectType;
    /**
     * 父级Id
     */
    protected $_parentId;
    /**
     * 子级Id
     */
    protected $_subId;
    /**
     * 关系
     */
    protected $_path;
    /**
     * 级别
     */
    protected $_level;


    public static function addPathLevel($objectType,$parentId,$subId,$path,$level)
    {
        $pathLevelItem = new Application_Model_PathLevel();
        $pathLevelItem->ObjectType = $objectType;
        $pathLevelItem->ParentId = $parentId;
        $pathLevelItem->SubId = $subId;
        $pathLevelItem->Path = $path;
        $pathLevelItem->Level = $level;
        $pathLevelItem->save();        
    }
    
    public static function bySubId($subId)
    {
        return self::getDao()->queryOne(array(" subId = " => $subId));
    }
    
    public static function byPath($path)
    {
        return self::getDao()->queryAll(array(" path like " => "%".$path."%"));
    }
    
}